package com.bdqn.dao;
import com.bdqn.utils.ConfigManager;
import java.sql.Connection;
import java.sql.DriverManager;
public class BaseDao {
    /**
     * 返回数据库连接实例5
     */
    public static Connection getConnection() {
        Connection connection = null;
        String driver = ConfigManager.getInstance().getValue("driver");
        String url = ConfigManager.getInstance().getValue("url");
        String username = ConfigManager.getInstance().getValue("username");
        String password = ConfigManager.getInstance().getValue("password");
        try {
            Class.forName(driver);
            connection = DriverManager.getConnection(url, username, password);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return connection; // 确保 return 语句在 try-catch 块外
    }
}